package edu.gdit.health.springIOC;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

//@Component实例化一个对象，组件/部件，细分类：@Controller,@Service,@Mapper,@Repository
@Component("littlebear")
public class Car {
//    @Value()适用于java的基本数据类型（int,long,double）和String
    @Value("Nissan")
    private String type;
    @Value("180")
    private int maxSpeed;

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public int getMaxSpeed() {
        return maxSpeed;
    }

    @Override
    public String toString() {
        return "Car{" +
                "type='" + type + '\'' +
                ", maxSpeed=" + maxSpeed +
                '}';
    }

    public void setMaxSpeed(int maxSpeed) {
        this.maxSpeed = maxSpeed;
    }
    public void print(){
        System.out.println(toString());
    }
}
